﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Web.UI;
using System.Text;

namespace Marbles.Core.Controls
{
    [ToolboxData("<{0}:GoogleSearch runat=server></{0}:GoogleSearch>")]
    public class GoogleSearch : WebControl
    {

        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute("border", "0");
            writer.AddAttribute("cellpadding", "2");
            writer.AddAttribute("cellspacing", "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute("colspan", "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.Center);
            writer.Write("<a href=\"http://www.google.co.uk\" target=\"_blank\" ><img src=\"http://www.google.co.uk/images/logos/ps_logo2.png\" width=\"175px\" height=\"65px\" alt=\"Google\" border=\"0\" /></a>");
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<input type=\"text\" id=\"googleSearch\" value=\"\" cols=\"80\" />");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<input type=\"button\" value=\"Find\" style=\"width:60px;\" onclick=\"SearchWindow('http://www.google.co.uk/search?q=' + document.getElementById('googleSearch').value,800,600);\" />");
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
    }
}
